<?php include_once 'common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once 'common/account_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
		
	<div class="admin_right_title">
		<strong>资金管理</strong> &gt;&gt; 修改银行卡号
		</div>
		<div class="admin_right_info">
			<form id="deductForm" name="deductForm" >
			<div class="admin_right_info_title"><h2>修改银行卡号</h2></div>
			<ul>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">用户ID：</div>
					<div class="admin_right_info_tr admin_right_info_m">
						<?php echo $user_id;?>
						<input  type="hidden" value="<?php echo $user_id;?>" name="user_id" id="user_id"/>
					</div>
				</li>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">开户银行：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<select name="bank" id="bank">
					<?php foreach($bank_list as $k => $v){ ?>
						<option <?php if($userinfo['bank']==$k){?>selected="selected"<?php }?> value="<?php echo $k; ?>"><?php echo $v; ?></option>
					<?php } ?>
					</select>
					</div>
				</li>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">开户行所在地：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<select name="province" id="province" onchange="changeCity(this.value,'city');">
						<option value="">请选择</option>
						</select>
						
					<select name="city" id="city" onchange="changeCity(this.value,'area');"><option value="">请选择</option></select>
					<select name="area" id="area"><option value="">请选择</option></select>
					</div>
				</li>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">开户支行：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<input type="text" name="branch" id="branch" size="20"  value="<?php echo $userinfo['branch'];?>"/>
					</div>
				</li>
				<li>
					<div class="admin_right_info_tr admin_right_info_l">银行账号：</div>
					<div class="admin_right_info_tr admin_right_info_m">
					<input type="text" name="account" id="account" size="20" value="<?php echo $userinfo['account'];?>" />
					</div>
				</li>
				<li>
					<input type="button" value="提交" onclick="toSubmit()" />
				</li>
			</ul>
			</form>
			</div>
	</div>
<!-- Admin_Right End -->
</div>
<!-- admin_main end -->

<script type="text/javascript">
$(document).ready(function(){
	<?php if(isset($userinfo) && $userinfo['province']>0 ){ ?>
		getArea(0,<?php echo $userinfo['province'];?>,'province');
		getArea(<?php echo $userinfo['province'];?>,<?php echo $userinfo['city'];?>,'city');
		getArea(<?php echo $userinfo['city'];?>,<?php echo $userinfo['area'];?>,'area');
	<?php }else{ ?>	
		getArea(0,'','province');
	<?php }?>
});
function changeCity(a,obj){
	var msg = "<option value=''>请选择</option>";
	if(a!=''){
		getArea(a,'',obj);
		if(obj=='city'){
			$("#area").html(msg);
		}
	}else{
		if(obj=='city'){
			$("#city").html(msg);
			$("#area").html(msg);
		}
	}
	
}
function getArea(pid, selected, obj){
	$.ajax({
		type: "POST",
		url: "/area/get_option",
		data: "pid="+pid+"&selected="+selected,
		success: function(msg){
			$("#"+obj).html(msg);
		},
		dataType: "text"
	});
}
function toSubmit(){
	var options = {
		url : '/ychadmin/account/edit_bank',
		dataType: "text",
		type:"post",
		success : function(ret) {
			if(ret==''){
				alert("提交成功");
			}else{
				alert(ret);
			}
		}
	};
	$("#deductForm").ajaxSubmit(options);
	return false;
}
</script>

<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
</body>
</html>
